package com.hut.oa.model.dao.workattend;

import java.util.Date;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import com.hut.oa.model.bean.User;
import com.hut.oa.model.bean.WorkAttend;

public interface WorkAttendDao extends PagingAndSortingRepository<WorkAttend, Long> {
	
	@Query(" from WorkAttend wa where to_days(wa.time) = to_days(now()) and wa.type=?1 and wa.user.id=?2 ")
	WorkAttend finByuidtypeto(String type,Long user);
	
	
	Page<WorkAttend> findByUser(User user ,Pageable pageable);
	
	List<WorkAttend> findByUser(User user);
	//查询两个时间段内的数据
	@Query("from WorkAttend wa where wa.time between ?1 and ?2")
	List<WorkAttend> findbytime(Date now1,Date now2);
}
